﻿<%@ Control Language="C#" Inherits="Yuanlin.Business.SetTemplateControl, Yuanlin.Business" AutoEventWireup="true" %>
<%@ Import Namespace="Yuanlin.Business" %>


<script type="text/javascript">
    addEvent(window, 'load', onLoad);
    
    function onLoad()
    {
        var selectedTemplate = document.getElementById("<%= hdnSelectedTemplate.ClientID %>").value;

        if(selectedTemplate!="")
        {
            var obj = document.getElementById(selectedTemplate);
            obj.checked = "checked";
        }
    }
    function checkPass()
    {   
        if(confirm("确定要设置模板吗？"))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    
    function SelectRadio(radioId)
    {
         var obj = document.getElementById(radioId);
         obj.checked = "checked";
         document.getElementById("<%= hdnSelectedTemplate.ClientID %>").value = obj.value;
    }
</script>

<div class="AdminArea">
    <fieldset>
        <legend>
            <nwap:ResourceLiteral runat="server" ResourceName="Applications_Yuanlin_Navigations_SetTemplate" ResourceFile="ControlPanelResources.xml"/>
        </legend>
        
        <asp:Repeater id="list" runat="server">
            <HeaderTemplate>
                <div class="box photoGallery">
                    <ul style="padding-top:10px;">
            </HeaderTemplate>
            <ItemTemplate>
                <li onclick="SelectRadio('<%#DataBinder.Eval(Container.DataItem, "Value") %>')" onMouseOver="this.className='photo_over';" onMouseOut="this.className='photo_out';">
	                <div class="photoFrame"><img src="<%= System.Web.Core.Globals.ApplicationPath %><%# DataBinder.Eval(Container.DataItem, "PicFilePath")%>"/></div>
	                <p><input type="radio" ID="<%#DataBinder.Eval(Container.DataItem, "Value") %>" value="<%#DataBinder.Eval(Container.DataItem, "Value") %>" name="TemplateList" /><%#DataBinder.Eval(Container.DataItem, "Name") %></p>
                </li>
            </ItemTemplate>
            <FooterTemplate>
                    </ul>
                </div>
            </FooterTemplate>
        </asp:Repeater>
        <input type="hidden" id="hdnSelectedTemplate" name="hdnSelectedTemplate" runat="server" />
        <div class="FormRow SubmitButtonRow">
            <div class="FormRow MiddleWidth">
                <nwap:Resourcebutton OnClientClick="return checkPass();" id="saveButton" ResourceName="Save" CssClass="Button" Runat="server"></nwap:Resourcebutton>
            </div>
        </div>                                                                              
    </fieldset>
</div>

